/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package library.impl;

import library.Book;
import library.BookState;
import library.LibraryPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc --> An implementation of the model object '<em><b>Book</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 * <li>{@link library.impl.BookImpl#getId <em>Id</em>}</li>
 * <li>{@link library.impl.BookImpl#getTitle <em>Title</em>}</li>
 * <li>{@link library.impl.BookImpl#getBookState <em>Book State</em>}</li>
 * <li>{@link library.impl.BookImpl#getPages <em>Pages</em>}</li>
 * <li>{@link library.impl.BookImpl#getCover <em>Cover</em>}</li>
 * <li>{@link library.impl.BookImpl#getAuthor <em>Author</em>}</li>
 * <li>{@link library.impl.BookImpl#getPublisher <em>Publisher</em>}</li>
 * </ul>
 * </p>
 * 
 * @generated
 */
public class BookImpl extends EObjectImpl implements Book {
	/**
	 * The default value of the '{@link #getId() <em>Id</em>}' attribute. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected static final String ID_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getId() <em>Id</em>}' attribute. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected String id = ID_EDEFAULT;

	/**
	 * The default value of the '{@link #getTitle() <em>Title</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getTitle()
	 * @generated
	 * @ordered
	 */
	protected static final String TITLE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getTitle()
	 * @generated
	 * @ordered
	 */
	protected String title = TITLE_EDEFAULT;

	/**
	 * The default value of the '{@link #getBookState() <em>Book State</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getBookState()
	 * @generated
	 * @ordered
	 */
	protected static final BookState BOOK_STATE_EDEFAULT = BookState.RENTABLE;

	/**
	 * The cached value of the '{@link #getBookState() <em>Book State</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getBookState()
	 * @generated
	 * @ordered
	 */
	protected BookState bookState = BOOK_STATE_EDEFAULT;

	/**
	 * The default value of the '{@link #getPages() <em>Pages</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getPages()
	 * @generated
	 * @ordered
	 */
	protected static final int PAGES_EDEFAULT = 100;

	/**
	 * The cached value of the '{@link #getPages() <em>Pages</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getPages()
	 * @generated
	 * @ordered
	 */
	protected int pages = PAGES_EDEFAULT;

	/**
	 * The default value of the '{@link #getCover() <em>Cover</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getCover()
	 * @generated
	 * @ordered
	 */
	protected static final String COVER_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getCover() <em>Cover</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getCover()
	 * @generated
	 * @ordered
	 */
	protected String cover = COVER_EDEFAULT;

	/**
	 * The default value of the '{@link #getAuthor() <em>Author</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getAuthor()
	 * @generated
	 * @ordered
	 */
	protected static final String AUTHOR_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getAuthor() <em>Author</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getAuthor()
	 * @generated
	 * @ordered
	 */
	protected String author = AUTHOR_EDEFAULT;

	/**
	 * The default value of the '{@link #getPublisher() <em>Publisher</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getPublisher()
	 * @generated
	 * @ordered
	 */
	protected static final String PUBLISHER_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getPublisher() <em>Publisher</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getPublisher()
	 * @generated
	 * @ordered
	 */
	protected String publisher = PUBLISHER_EDEFAULT;

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	protected BookImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */

	protected EClass eStaticClass() {
		return LibraryPackage.Literals.BOOK;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setTitle(String newTitle) {
		String oldTitle = title;
		title = newTitle;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					LibraryPackage.BOOK__TITLE, oldTitle, title));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public BookState getBookState() {
		return bookState;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setBookState(BookState newBookState) {
		BookState oldBookState = bookState;
		bookState = newBookState == null ? BOOK_STATE_EDEFAULT : newBookState;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					LibraryPackage.BOOK__BOOK_STATE, oldBookState, bookState));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public int getPages() {
		return pages;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setPages(int newPages) {
		int oldPages = pages;
		pages = newPages;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					LibraryPackage.BOOK__PAGES, oldPages, pages));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public String getCover() {
		return cover;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setCover(String newCover) {
		String oldCover = cover;
		cover = newCover;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					LibraryPackage.BOOK__COVER, oldCover, cover));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public String getAuthor() {
		return author;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setAuthor(String newAuthor) {
		String oldAuthor = author;
		author = newAuthor;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					LibraryPackage.BOOK__AUTHOR, oldAuthor, author));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public String getPublisher() {
		return publisher;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setPublisher(String newPublisher) {
		String oldPublisher = publisher;
		publisher = newPublisher;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					LibraryPackage.BOOK__PUBLISHER, oldPublisher, publisher));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public String getId() {
		return id;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setId(String newId) {
		String oldId = id;
		id = newId;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					LibraryPackage.BOOK__ID, oldId, id));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */

	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case LibraryPackage.BOOK__ID:
			return getId();
		case LibraryPackage.BOOK__TITLE:
			return getTitle();
		case LibraryPackage.BOOK__BOOK_STATE:
			return getBookState();
		case LibraryPackage.BOOK__PAGES:
			return new Integer(getPages());
		case LibraryPackage.BOOK__COVER:
			return getCover();
		case LibraryPackage.BOOK__AUTHOR:
			return getAuthor();
		case LibraryPackage.BOOK__PUBLISHER:
			return getPublisher();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */

	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case LibraryPackage.BOOK__ID:
			setId((String) newValue);
			return;
		case LibraryPackage.BOOK__TITLE:
			setTitle((String) newValue);
			return;
		case LibraryPackage.BOOK__BOOK_STATE:
			setBookState((BookState) newValue);
			return;
		case LibraryPackage.BOOK__PAGES:
			setPages(((Integer) newValue).intValue());
			return;
		case LibraryPackage.BOOK__COVER:
			setCover((String) newValue);
			return;
		case LibraryPackage.BOOK__AUTHOR:
			setAuthor((String) newValue);
			return;
		case LibraryPackage.BOOK__PUBLISHER:
			setPublisher((String) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */

	public void eUnset(int featureID) {
		switch (featureID) {
		case LibraryPackage.BOOK__ID:
			setId(ID_EDEFAULT);
			return;
		case LibraryPackage.BOOK__TITLE:
			setTitle(TITLE_EDEFAULT);
			return;
		case LibraryPackage.BOOK__BOOK_STATE:
			setBookState(BOOK_STATE_EDEFAULT);
			return;
		case LibraryPackage.BOOK__PAGES:
			setPages(PAGES_EDEFAULT);
			return;
		case LibraryPackage.BOOK__COVER:
			setCover(COVER_EDEFAULT);
			return;
		case LibraryPackage.BOOK__AUTHOR:
			setAuthor(AUTHOR_EDEFAULT);
			return;
		case LibraryPackage.BOOK__PUBLISHER:
			setPublisher(PUBLISHER_EDEFAULT);
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */

	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case LibraryPackage.BOOK__ID:
			return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
		case LibraryPackage.BOOK__TITLE:
			return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT
					.equals(title);
		case LibraryPackage.BOOK__BOOK_STATE:
			return bookState != BOOK_STATE_EDEFAULT;
		case LibraryPackage.BOOK__PAGES:
			return pages != PAGES_EDEFAULT;
		case LibraryPackage.BOOK__COVER:
			return COVER_EDEFAULT == null ? cover != null : !COVER_EDEFAULT
					.equals(cover);
		case LibraryPackage.BOOK__AUTHOR:
			return AUTHOR_EDEFAULT == null ? author != null : !AUTHOR_EDEFAULT
					.equals(author);
		case LibraryPackage.BOOK__PUBLISHER:
			return PUBLISHER_EDEFAULT == null ? publisher != null
					: !PUBLISHER_EDEFAULT.equals(publisher);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */

	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (id: ");
		result.append(id);
		result.append(", title: ");
		result.append(title);
		result.append(", bookState: ");
		result.append(bookState);
		result.append(", pages: ");
		result.append(pages);
		result.append(", cover: ");
		result.append(cover);
		result.append(", author: ");
		result.append(author);
		result.append(", publisher: ");
		result.append(publisher);
		result.append(')');
		return result.toString();
	}

} // BookImpl
